{include file='pub/header'/}
<title>编辑活动</title>
</head>
<body>
<div class="page-container">
    <form class="form form-horizontal" id="charge_form" action="{:url('Marketing/charge_edit')}" method="post">
        <input type="hidden" name="id" value="{$item.id}">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>充值金额：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$item.money}" placeholder="" name="money">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>赠送金额：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$item.given_money}" placeholder="" name="given_money">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>是否开启：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <label><input type="radio" name="status" value="1" {eq name="item.status" value="1" }checked{/eq}/>开启</label>
                <label><input type="radio" name="status" value="0" {eq name="item.status" value="0" }checked{/eq}/>关闭</label>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                <button class="btn btn-secondary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存设置
                </button>
            </div>
        </div>
    </form>
</div>
{include file="pub/footer"/}
<script type="text/javascript">
    $(function () {
        $("#charge_form").validate({
            rules: {
                money: {
                    required: true,
                    number: true
                },
                given_money: {
                    required: true,
                    number: true
                }
            },
            messages: {
                money: {
                    required: '充值金额不能为空'
                },
                is_open: {
                    required: '赠送金额不能为空'
                }
            },
            onkeyup: false,
            focusCleanup: true,
            success: 'valid',
            submitHandler: function (form) {
                $(form).ajaxSubmit(function (res) {
                    if (res.code == 1) {
                        parent.location.reload();
                        layer_close();
                    } else {
                        layer.alert(res.msg);
                    }
                });
            }
        });
    });
</script>
</body>
</html>